;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;  Records.lisp
;;
;;  copyright © 1987-89 Apple Computer
;;
;;  This file contains definitions for Pascal style record structures, used
;;  for interfacing with the Macintosh operating system.
;;
;;  Definitions for records used by color quickdraw can be found in the
;;  file Color-Examples.lisp.
;;
;;  Other record definitions can be found in Inside Macintosh.
;;
;;  version 1.1
;;


(defrecord Rect 
  (variant ((top integer 0)
            (left integer 0))
           ((topleft point)))
  (variant ((bottom integer 0)
            (right integer 0))
           ((bottomright point))))

(defrecord bitMap 
  (baseAddr pointer) 
  (rowBytes integer) 
  (bounds rect))

(defrecord Bits16 
  (L0 longint) 
  (L1 longint) 
  (L2 longint) 
  (L3 longint)
  (L4 longint) 
  (L5 longint)
  (L6 longint) 
  (L7 longint))

(defrecord (control handle)
  (nextControl (control handle))
  (Owner (window pointer))
  (rect rect)
  (Vis boolean)
  (Hilite byte)
  (Value integer)
  (Min integer)
  (Max integer)
  (DefProc handle)
  (Data handle)
  (Action pointer)
  (RfCon longint)
  (Title (string 255)))

(defrecord Cursor 
  (data Bits16) 
  (mask Bits16) 
  (hotSpot point))

(defrecord Event
  (what integer)
  (message longint)
  (when longint)
  (where point)
  (modifiers integer))

(defrecord FontInfo
  (ascent integer) 
  (descent integer) 
  (widMax integer) 
  (leading integer))

(defrecord pattern 
  (variant ((w0 integer)
            (w1 integer)
            (w2 integer)
            (w3 integer))
           ((b0 byte)
            (b1 byte)
            (b2 byte)
            (b3 byte)
            (b4 byte)
            (b5 byte)
            (b6 byte)
            (b7 byte))))

(defrecord grafport
  (device integer)
  (portbits BitMap)
  (portRect rect)
  (visRgn (region handle))
  (clipRgn (region handle))
  (bkPat pattern)
  (fillPat pattern)
  (pnLoc point)
  (pnSize point)
  (pnMode integer)
  (pnPat pattern)
  (pnVis integer)
  (txFont integer)
  (txFace integer)
  (txMode integer)
  (txSize integer)
  (spExtra longint)  ;beware old Inside Macintosh says 2 bytes.
  (fgColor longint)
  (bkcolor longint)
  (colrBit integer)
  (patStretch integer)
  (picSave handle)
  (rgnSave handle)
  (polySave handle)
  (grafProcs pointer))

(defrecord window 
  (port grafport)
  (windowKind integer)
  (visible boolean)
  (hilited boolean)
  (goAwayFlag boolean)
  (spareFlag boolean)
  (strucRgn (region handle))
  (contRgn (region handle))
  (updateRgn (region handle))
  (windowDefProc handle)
  (dataHandle handle)
  (titleHandle handle)
  (titleWidth integer)
  (controlList (control handle))
  (nextWindow (window pointer))
  (windowPic handle)
  (refCon longint))

(defrecord dialog
  (window window)
  (items handle)
  (textH (TERec handle))
  (editField integer)
  (editOpen integer)
  (aDefItem integer))

(defrecord dialog-item
  (variant ((hCtl handle)) ((hText handle)) ((hProc handle)))
  (rect rect)
  (type byte)
  (datasize byte)
  (data integer))

(defrecord (list handle)
  (rView rect)
  (port pointer)
  (indent point)
  (cellsize point)
  (visible rect)
  (vscroll handle)
  (hscroll handle)
  (selFlags byte)
  (lActive boolean)
  (lreserved byte)
  (listFlags byte)
  (clikTime longint)
  (clikLoc point)
  (mouseloc point)
  (lClikLoop pointer)
  (lastclick point)
  (refcon longint)
  (listDefProc handle)
  (userhandle handle)
  (dataBounds rect)
  (cells Handle)
  (maxIndex integer)
  (cellarray integer))

(defrecord PenState 
  (pnLoc point)
  (pnSize point) 
  (pnMode integer)
  (pnPat pattern))

(defrecord (Picture handle) 
  (picSize integer)
  (picFrame Rect))

(defrecord (Polygon handle)
  (polySize integer) 
  (polyBox Rect))

(defrecord regbuf
  (rD0 pointer)
  (rD1 pointer)
  (rD2 pointer)
  (rD3 pointer)
  (rD4 pointer)
  (rD5 pointer)
  (rD6 pointer)
  (rD7 pointer)
  (rA0 pointer)
  (rA1 pointer)
  (rA2 pointer)
  (rA3 pointer)
  (rA4 pointer)
  (rA5 pointer)
  (rA6 pointer)
  (rA7 pointer)
  (rSR integer))

(defrecord (Region handle)
  (rgnSize integer) 
  (rgnBBox Rect))

(defrecord SFReply
  (good boolean)
  (copy boolean)
  (fType OSType)
  (vRefNum integer)
  (version integer)
  (fName (string 63)))

(defrecord (TERec handle)
  (destRect rect)
  (viewRect rect)
  (selRect rect)
  (lineHeight integer)
  (fontAscent integer)
  (selPoint point)
  (selStart integer)
  (selEnd integer)
  (active integer)
  (wordBreak pointer)
  (clikLoop pointer)
  (clickTime longint)
  (clickLoc integer)
  (caretTime longint)
  (caretState integer)
  (just integer)
  (teLength integer)
  (hText handle)
  (recalBack integer)
  (recalLines integer)
  (clikStuff integer)
  (crOnly integer)
  (txFont integer)
  (txFace integer)
  (txMode integer)
  (txSize integer)
  (inPort (grafport pointer))
  (highHook pointer)
  (caretHook pointer)
  (nLines integer)
  (lineStarts LongInt))



(provide 'records)
(if (not (memq :records *features*))
  (setq *features* (cons :records *features*)))